<?php

namespace App\Enum;

class GoodsEnum implements BasicEnumInterface
{
    // 库存状态  1.现货 2预收
    const STOCK_STATUS_STR = 'stock';
    const STOCK_STATUS_1= 1;
    const STOCK_STATUS_2= 2;
    // 启用状态 1.启用 2禁用
    const ENABLE_STATUS_STR = 'enable';
    const ENABLE_STATUS_1 = 1;
    const ENABLE_STATUS_2 = 2;
    // 售卖方式状态  1一口价 2拼团
    const SALES_METHOD_STR = 'sales_method';
    const SALES_METHOD_1 = 1;
    const SALES_METHOD_2 = 2;

    public static function getStrByEnum($enum, $type)
    {
        $stockArr = [
            1 => trans('key.stock_1'),
            2 => trans('key.stock_2')
        ];
        $enableArr = [
            1 => trans('key.enable'),
            2 => trans('key.disable')
        ];
        $salesMethodArr = [
            1 => trans('key.sales_method_1'),
            2 => trans('key.sales_method_2')
        ];
        $statusMap = [
            self::STOCK_STATUS_STR => $stockArr,
            self::ENABLE_STATUS_STR => $enableArr,
            self::SALES_METHOD_STR => $salesMethodArr
        ];

        return $statusMap[$type][$enum] ?? null;
    }
}
